#include "bt_thread.h"
#include "SortFun.h"
#include "sndarecord.pb.h"
#include "operationfun.h"
#include "ReadRawFile.h"

extern mutex_block split_lock;
extern int needsplit;
extern int splited;
extern saft_deque<splittxtfilearg> request_splittxtfilearg;

void * SlipTxtThread(void *)
{
    
    while(1)
    {
        
        splittxtfilearg arg;
        if(request_splittxtfilearg.pop(arg))
        {
            // GET A REOCARD
            SplitTxtFile5<keybaserecord, operation_keybaserecord_bykey>(
                    arg.srcfile, arg.dirs, *(arg.filelist), arg.splitsize);
            split_lock.lock();
            ++splited;
            split_lock.unlock();
        }
        else
        {
            ::sleep_s(0, 0, 1, 0);
        }
        
    }
    return NULL;
    
}

